
var app = new Vue({
    el:"#app",
    data:{
        form:{
            mz:'01',        //民族
            csd:'37',       //出生地


            dist1:37e4,
            dist2:3706e2,
            hkszd:370602,   //户口所在地
            sfzh:"",      //身份证号
            lxdh:"",      //联系电话
            zwx:"",       //中文姓
            zwm:"",       //中文名
            ywx:"",       //英文姓
            ywm:"",       //英文名
            jjqklxr:"",   //紧急情况联系人
            jjqklxrdh:"", //紧急情况联系人电话
            sqlbArray:[],       //申请类别
            qwdArray:[],         //前往地
            sqlb:"",
            qwd:"",
            bzlbHz:'11',   //普通护照办证类别
            xczjhmHz:"",
            xczjyxqzHz:'2018-04-17',
            cymjz:"",
            xmjz:"",
            cczjz:"",

            bzlbGa:'11',   //港澳通行证办证类别
            xczjhmGa:"",
            xczjyxqzGa:'2018-04-18',
            qzzlHkg:'12',   //香港签注种类
            qzzlMac:'12',   //澳门签注种类
            qzcsHkg:'0301', //香港签注次数
            qzcsMac:'0301', //澳门签注次数


            bzlbTw:'11',   //台湾通行证办证类别
            xczjhmTw:"",
            xczjyxqzTw:'2018-04-19',
            qzzlTwn:'25',   //台湾签注种类
            qzcsTwn:'0601', //台湾签注次数

            sfxtkzd: '0',
            sjr:"",
            yzbm:"",
            emsdz:"",
            sjhm:""


        },
        mzOptions:mzOptions,
        csdOptions:csdOptions,
        distOptions1:distData[1e5],
        bzlbOptionsHz:[{key:'11',value:'首次申领'},{key:'22',value:'补发'},{key:'31',value:'换发'},{key:'13',value:'失效重新申领'},{key:'71',value:'加注'}],
        bzlbOptionsGa:[{key:'11',value:'首次申领'},{key:'22',value:'补发'},{key:'31',value:'换发'},{key:'13',value:'失效重新申领'}],
        bzlbOptionsTw:[{key:'11',value:'首次申领'},{key:'22',value:'补发'},{key:'31',value:'换发'},{key:'13',value:'失效重新申领'}],
        qzzlHkgOptions:[{key:'12',value:'团队旅游'},{key:'1B',value:'个人旅游'},{key:'13',value:'商务'},{key:'11',value:'探亲'},{key:'1G',value:'逗留'},{key:'19',value:'其他'}],
        qzzlMacOptions:[{key:'12',value:'团队旅游'},{key:'1B',value:'个人旅游'},{key:'13',value:'商务'},{key:'11',value:'探亲'},{key:'1G',value:'逗留'},{key:'19',value:'其他'}],
        qzzlTwnOptions:[{key:'25',value:'团队旅游'},{key:'2B',value:'个人旅游'},{key:'21',value:'探亲'},{key:'27',value:'经贸交流'},{key:'22',value:'应邀'},{key:'23',value:'定居'},{key:'2A',value:'就学'},{key:'26',value:'乘务'},{key:'29',value:'其他'}],
        applyId:null
    },
    methods:{
        viewTips:function (val) {
            return "/apply/tips/page?applyId="+val;
        }
    },
    computed:{
        mzName:function()
        {
            return getValue(mzOptions,this.form.mz);
        },
        csdName:function(){
            return getValue(csdOptions,this.form.csd);
        },
        qzfsName:function(){
            if (this.form.sfxtkzd=='0')
            {
                return "前往受理机关领取";
            }
            else{
                return "邮寄送达";
            }
        },
        distName1:function(){
            return distName(this.form.dist1);
        },
        distName2:function(){
            return distName(this.form.dist2);
        },
        distName3:function(){
            return distName(this.form.hkszd);
        },
        zwx:{
            set:function (newValue) {
                this.form.ywx = convertPinYin(newValue);

                if((this.form.zwx+this.form.zwm)== this.form.sjr)
                {
                    this.form.sjr = newValue+this.form.zwm;
                }
                this.form.zwx = newValue;
            },
            get:function () {
                return this.form.zwx;
            }
        },
        zwm:{
            set:function (newValue) {
                this.form.ywm = convertPinYin(newValue);
                if((this.form.zwx+this.form.zwm)== this.form.sjr)
                {
                    this.form.sjr = this.form.zwx + newValue;
                }
                this.form.zwm = newValue;
            },
            get:function () {
                return this.form.zwm;
            }
        },
        lxdh:{
            set:function (newValue) {
                if (this.form.lxdh==this.form.sjhm)
                {
                    this.form.sjhm = newValue;
                }
                this.form.lxdh=newValue;
            },
            get:function () {
                return this.form.lxdh;
            }
        },

        bzlbNameHz:function(){
            var bzlbName = getValue(bzlbOptions,this.form.bzlbHz);
            return bzlbName;
        },
        bzlbNameGa:function(){
            var bzlbName = getValue(bzlbOptions,this.form.bzlbGa);
            if(!checkNull(bzlbName))
            {
                bzlbName = '仅签注';
            }
            return bzlbName;
        },
        bzlbNameTw:function(){
            var bzlbName =  getValue(bzlbOptions,this.form.bzlbTw);
            if(!checkNull(bzlbName))
            {
                bzlbName = '仅签注';
            }
            return bzlbName;
        },

        /**
         * 办理护照内容显示
         */
        blhzDisplay:function () {
            return !(checkContains(this.form.sqlb,'101'));
        },
        /**
         * 护照资料内容显示
         */
        hzzlDisplay:function () {
            return !(checkContains(this.form.sqlb,'101')&&this.form.bzlbHz!='11');
        },
        /**
         * 护照加注内容显示
         */
        hzjzDisplay:function () {
            return !(checkContains(this.form.sqlb,'101')&&this.form.bzlbHz=='71');
        },
        hzcymjzDisplay:function () {
            return !(checkContains(this.form.sqlb,'101')&&this.form.bzlbHz=='71'&&!checkNull(this.form.cymjz));
        },
        hzxmjzDisplay:function () {
            return !(checkContains(this.form.sqlb,'101')&&this.form.bzlbHz=='71'&&!checkNull(this.form.xmjz));
        },
        hzcczjzDisplay:function () {
            return !(checkContains(this.form.sqlb,'101')&&this.form.bzlbHz=='71'&&!checkNull(this.form.cczjz));
        },
        blgaDisplay:function(){
            return !(checkContains(this.form.sqlb,'102'));
        },
        gazlDisplay:function(){

            if(checkContains(this.form.sqlb,'102'))
            {
                return !(this.form.bzlbGa!='11');
            }
            else {
                return !(checkContains(this.form.qwd,'HKG')||checkContains(this.form.qwd,'MAC'));
            }
        },
        xgqzDisplay:function(){
            return !(checkContains(this.form.qwd,'HKG'));
        },
        amqzDisplay:function(){
            return !(checkContains(this.form.qwd,'MAC'));
        },
        bltwDisplay:function(){
            return !(checkContains(this.form.sqlb,'104'));
        },
        twzlDisplay:function(){

            if(checkContains(this.form.sqlb,'104'))
            {
                return !(this.form.bzlbTw!='11');
            }
            else {
                return !(checkContains(this.form.qwd,'TWN'));
            }
        },
        twqzDisplay:function(){
            return !(checkContains(this.form.qwd,'TWN'));
        },
        emsDisplay:function(){
            return !(this.form.sfxtkzd=='1');
        },
        qzzlNameXg:function () {
            var qzzlName = getValue(qzzlOptions,this.form.qzzlHkg);
            var qzcsName = getValue(qzcsOptions,this.form.qzcsHkg);
            if (checkNull(qzcsName))
            {
                qzzlName += " - " +qzcsName;
            }
            return qzzlName;
        }
        ,
        qzzlNameAm:function () {
            var qzzlName = getValue(qzzlOptions,this.form.qzzlMac);
            var qzcsName = getValue(qzcsOptions,this.form.qzcsMac);
            if (checkNull(qzcsName))
            {
                qzzlName += " - " +qzcsName;
            }
            return qzzlName;
        },
        qzzlNameTw:function () {
            var qzzlName = getValue(qzzlOptions,this.form.qzzlTwn);
            var qzcsName = getValue(qzcsOptions,this.form.qzcsTwn);
            if (checkNull(qzcsName))
            {
                qzzlName += " - " +qzcsName;
            }
            return qzzlName;
        }


    },

    created:function () {
        // var that = this;
        // that.applyId = $("#applyId").val();
        // $.post("/apply/getById",{applyId:that.applyId},function (result) {
        //     for(var p in result)
        //     {
        //         that.form[p] = result[p];
        //     }
        // });
        this.form = apply;
    }
});



$(document).ready(function () {
    var u = navigator.userAgent;
    if (u.indexOf('Android') > -1)
    {
        $("#distMask").hide();
    }
});

